@use "sass:meta";
$tablet-width: 996px;
$desktop-width: 997px;
$desktop-xl-width: 1160px;

@mixin tablet {
  @media (max-width: #{$tablet-width}) {
    @content;
  }
}

@mixin desktop {
  @media (min-width: #{$desktop-width}) {
    @content;
  }
}

@mixin desktopWide {
  @media (min-width: #{$desktop-xl-width}) {
    @content;
  }
}

/* stylelint-disable docusaurus/copyright-header */
/**
 * Any CSS included here will be global. The classic template
 * bundles Infima by default. Infima is a CSS framework designed to
 * work well for content-centric websites.
 */

/* You can override the default Infima variables here. */
:root {
  --ifm-background-color: var(--ifm-color-primary-light);
  --ifm-code-background: var(--ifm-color-primary-dark);
  --ifm-code-font-size: 100%;
  --ifm-code-color: var(--ifm-color-primary-light);
  --ifm-code-padding-vertical: 0.05rem;
  --ifm-code-padding-horizontal: 0.2rem;
  --ifm-color-primary: #0e2b3d;
  --ifm-color-primary-dark: #131226;
  --ifm-color-primary-darker: #0d0c1b;
  --ifm-color-primary-darkest: rgb(26, 136, 112);
  --ifm-color-primary-light: #fffef6;
  --ifm-color-primary-lighter: rgb(102, 212, 189);
  --ifm-color-primary-lightest: rgb(146, 224, 208);
  --ifm-color-secondary: #fefad8;
  --ifm-color-success: #fcc009;
  --ifm-color-info: #40b9bc;
  --ifm-color-warning: #ef7b1a;
  --ifm-color-danger: #be1d43;
  --ifm-container-width-xl: 100%;
  --ifm-font-color-base: var(--ifm-color-primary-dark);
  --ifm-font-family-base: "Karla", sans-serif;
  --ifm-font-family-title: "Montserrat", "Arial", sans-serif;
  --ifm-font-family-monospace: "Source Code Pro", monospace;
  --ifm-h2-font-size: 2rem;
  --ifm-leading-desktop: 1;
  --ifm-link-color: var(--ifm-color-primary-dark);
  --ifm-link-hover-color: var(--ifm-color-primary);
  --ifm-menu-color: var(--ifm-color-primary-dark);
  --ifm-menu-color-active: var(--ifm-color-primary-dark);
  --ifm-menu-color-background-hover: #fdf9d7;
  --ifm-menu-color-background-active: var(--ifm-menu-color-background-hover);
  --ifm-navbar-height: 6rem;
  --ifm-navbar-background-color: var(--ifm-color-primary-dark);
  --ifm-navbar-padding-vertical: 0;
  --ifm-pagination-nav-border-radius: 0;
  --ifm-pre-padding: 2rem;
  --ifm-toc-link-color: var(--ifm-color-primary-dark);
}

html[data-theme="dark"] {
  --ifm-background-color: var(--ifm-color-primary-dark);
  --ifm-navbar-background-color: var(--ifm-color-primary-darker);
  --ifm-menu-color: var(--ifm-color-primary-light);
  --ifm-menu-color-active: var(--ifm-color-primary-light);
  --ifm-menu-color-background-active: var(--ifm-color-primary);
  --ifm-link-color: var(--ifm-color-primary-light);
  --ifm-link-hover-color: var(--ifm-color-primary-light);
  --ifm-toc-link-color: var(--ifm-color-primary-light);
  --ifm-pagination-nav-color-hover: var(--ifm-color-primary-light);
  --ifm-tabs-color-active: var(--ifm-color-primary-light);
  --ifm-table-stripe-background: #2e526a;
  --ifm-code-background: var(--ifm-color-primary-dark);
  --ifm-heading-color: var(--ifm-color-primary-light);
  --ifm-menu-color-background-hover: var(--ifm-color-primary);
  --ifm-blockquote-color: var(--ifm-menu-color-background-hover);
  --ifm-color-emphasis-300: var(--ifm-menu-color-background-hover);
}

/* global */

h1,
h2,
h3 {
  font-family: var(--ifm-font-family-title);
}

h2 {
  font-weight: 700;
  line-height: 32px;
}

code,
.table-of-contents__link code,
.table-of-contents__link:hover code {
  margin: 0 1px;
  color: var(--ifm-code-color);
  .alert & {
    color: var(--ifm-alert-foreground-color);
  }
}

.markdown {
  & > h2 {
    --ifm-h2-font-size: 1.5rem;
    --ifm-h2-vertical-rhythm-top: 4;
  }

  & > h3 {
    --ifm-h3-font-size: 1.1875rem;
    --ifm-h3-vertical-rhythm-top: 3;
  }

  & > h2 + h3 {
    --ifm-h3-vertical-rhythm-top: 2;
  }

  a:not(.card) {
    font-weight: bold;
    text-decoration: underline;
    color: var(--ifm-color-primary-dark);

    html[data-theme="dark"] & {
      color: var(--ifm-color-primary-light);
    }

    &:hover {
      color: var(--ifm-color-primary);
      html[data-theme="dark"] & {
        color: var(--ifm-color-secondary);
      }
    }

    &:active {
      color: var(--ifm-color-info);
      html[data-theme="dark"] & {
        color: var(--ifm-color-info);
      }
    }
  }

  li {
    font-size: 18px;
  }

  img {
    display: block;
    margin: auto;
    width: 100%;
  }
}

p {
  font-size: 18px;
  font-weight: 400;
  line-height: 24px;
}

a.menu__link[target="_blank"] {
  svg {
    display: none;
  }
  &:after {
    background: var(--ifm-color-primary-darker);
    mask: url("/img/Dagger_Icons_External-link.svg") no-repeat;
    position: absolute;
    content: "";
    right: var(--ifm-menu-link-padding-horizontal);
    top: var(--ifm-menu-link-padding-vertical);
    height: 1.25rem;
    width: 1.25rem;
  }
  html[data-theme="dark"] &:after {
    background: var(--ifm-color-primary-light);
  }
}

h1[class^="h1Heading"] {
  margin-bottom: 3rem;
}

.theme-edit-this-page {
  font-weight: bold;
  display: flex;
  align-items: center;
  margin: 2rem 0 5rem;

  html[data-theme="dark"] & svg path {
    fill: var(--ifm-color-primary-light);
  }
}

#__docusaurus {
  background-color: white;

  html[data-theme="dark"] & {
    background: var(--ifm-color-primary-darker);
  }
}

.docusaurus-highlight-code-line {
  background-color: rgb(72, 77, 91);
  display: block;
  margin: 0 calc(-1 * var(--ifm-pre-padding));
  padding: 0 var(--ifm-pre-padding);
}

.button {
  background: var(--ifm-color-secondary);
  color: var(--ifm-navbar-link-color);
  font-family: var(--ifm-font-family-title);
  font-size: 1rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0em;
  text-align: left;
  padding: 0.625rem 1.5rem;
  border: 0;
  border-radius: 50px;

  &:hover {
    background: #ffffff;
    color: var(--ifm-navbar-link-color);
    cursor: pointer;
  }

  &:active {
    background: #131226;
    color: var(--ifm-color-secondary);
  }
}

.hash-link,
.hash-link::before {
  color: var(--ifm-color-info);
}
/* navbar */
.navbar__brand .navbar__logo {
  height: 5rem;
  @include desktop {
    height: var(--ifm-navbar-height);
  }
}

.navbar {
  align-self: center;
  box-shadow: none;
  width: 100%;
}

.navbar-sidebar__back {
  background: transparent;
  color: white;
  padding: 1rem 0;
  text-align: center;
}

.navbar__item {
  margin: 0 0.75rem;
}

.react-toggle {
  margin: 0 0.75rem;
}

.header-discord-link,
.header-github-link {
  height: 48px;
  line-height: 36px;
  @include desktop {
    width: 48px;
    text-indent: 9999px;
    white-space: nowrap;
    overflow: hidden;
  }
}

.header-github-link,
.header-github-link:hover {
  background: url("/img/github-icon.svg") no-repeat;
  @include tablet {
    background-color: var(--ifm-color-primary);
  }
}

.header-discord-link,
.header-discord-link:hover {
  background: url("/img/discord-icon.svg") no-repeat;
  @include tablet {
    background-color: var(--ifm-color-primary);
  }
}

.navbar .button svg {
  display: none;
}

.navbar__toggle {
  filter: brightness(19);
}

/* sidebar */

a[class^="sidebarLogo"] {
  img {
    display: none !important;
  }
  background: url("/img/dagger-logo-dark.png") no-repeat left center;
  background-size: contain;

  html[data-theme="dark"] & {
    background: url("/img/dagger-logo.png") no-repeat left center;
    background-size: contain;
  }
}

/* main */
.main-wrapper {
  align-self: center;
  width: 100%;
}

main[class^="docMainContainer"] {
  background: #ffffff;
  padding: 2rem;

  @include tablet {
    padding: 2rem;
  }

  html[data-theme="dark"] & {
    background: var(--ifm-color-primary-dark);
    color: var(--ifm-color-primary-light);
  }
}

/* table-of-contents */
.table-of-contents {
  font-size: 1rem;
}

.table-of-contents__link--active {
  font-weight: bold;
}

html[data-theme="dark"] .table-of-contents__link {
  &--active,
  &:hover {
    color: var(--ifm-color-primary-light);
  }
}

// tabs

/* codeBlock */
div[class^="codeBlockContainer"] {
  margin-bottom: 2.5rem;

  div[class^="codeBlockTitle"] {
    background-color: var(--ifm-color-primary-dark) !important;
    border-bottom: 1px solid #606770;
    font-family: var(--ifm-font-family-monospace);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  pre {
    border-radius: var(--ifm-global-radius);
  }
}

code[class^="codeBlockLines"] {
  background-color: var(--ifm-color-primary-dark) !important;
  border-radius: 0;
  margin: 0;
  .token-line {
    color: var(--ifm-color-primary-light) !important;
  }

  html[data-theme="dark"] & {
    background-color: var(--ifm-color-primary-darker) !important;
  }
}

button[class^="copyButton"] {
  background-color: var(--ifm-color-primary-light);
  color: var(--ifm-color-primary-dark);
}

/* badge */
.badge--secondary {
  color: var(--ifm-color-primary-dark);
}

.menu {
  padding: 3rem 0.5rem 0.5rem !important;
}

.menu__link.button {
  width: 190px;
  margin: auto;
}

.menu__link:not(.button) {
  @include tablet {
    background-color: transparent;
    color: var(--ifm-color-primary-light);
    // --ifm-menu-color-active: var(--ifm-color-primary-light);
    // --ifm-menu-color-background-active: var(--ifm-color-primary);
    span {
      display: block;
      margin-left: 3rem;
      color: white;
    }
  }
}

.menu__link--active:not(.menu__link--sublist) {
  font-weight: bold;
  @include tablet {
    background: var(--ifm-color-primary);
  }
}

.menu__link--active:hover {
  @include tablet {
    color: var(--ifm-color-primary-light);
  }
}

/* docsearch */

.DocSearch-Button {
  margin-right: 2rem !important;
  @include desktop {
    width: 200px;
  }
  @include desktopWide {
    width: 350px;
  }
  html[data-theme="dark"] & {
    background-color: white;
  }
}

.DocSearch-Button {
  margin-right: 2rem !important;
  @media (min-width: 997px) {
    width: 200px;
  }
  @media (min-width: 1160px) {
    width: 350px;
  }
  html[data-theme="dark"] & {
    background-color: white;
  }
}

/* pagination */
.pagination-nav__label svg {
  vertical-align: middle;

  html[data-theme="dark"] & path {
    fill: var(--ifm-color-primary-light);
  }
}

/* admonition */

div[class*="admonition-"] .admonition-icon svg {
  display: none;
}

img[alt="github-contribute"] {
  display: block;
  width: 180px;
}

@mixin admonitionIcon($args...) {
  @each $name, $path in meta.keywords($args) {
    $bgColor: if(
      $name==danger,
      var(--ifm-color-primary-light),
      var(--ifm-color-primary-dark)
    );
    .admonition-#{$name} .admonition-icon::before {
      mask: url($path);
      content: "";
      background-color: var(--ifm-alert-foreground-color);
      display: block;
      width: 22px;
      height: 22px;
    }
  }
}

@include admonitionIcon(
  $note: "/img/Dagger_Icons_Note.svg",
  $tip: "/img/Dagger_Icons_Tip.svg",
  $info: "/img/Dagger_Icons_Info.svg",
  $caution: "/img/Dagger_Icons_Caution.svg",
  $danger: "/img/Dagger_Icons_Danger.svg"
);
